package com.ruoyi.inspection.config;

import com.ruoyi.common.utils.StringUtils;

import java.util.Arrays;

public enum JobDepartmentEnum {
    DEPARTMENT_1("上海电力建设修造有限公司", "上海电力", "91310109133131944U"),
    DEPARTMENT_2("上海启丰电子科技有限公司", "启丰", "913101136693951475"),
    DEPARTMENT_3("上海石化消防工程有限公司", "上海石化", "91310230134233897D"),
    DEPARTMENT_4("上海富盘石化设备有限公司", "富盘石化", "91310113735406810L"),
    DEPARTMENT_5("上海宏凯设备安装有限公司", "宏凯", "913102306311412561"),
    DEPARTMENT_6("上海宝建集团有限公司", "宝建", "913100001322456670"),
    DEPARTMENT_7("上海秦汉安防技术有限公司", "秦汉", ""),
    DEPARTMENT_8("上海消防安全服务有限公司", "上海消防", "91310000132671199H"),
    DEPARTMENT_9("江苏鼎鑫油罐清洗有限公司", "鼎鑫", "9132032407273242XD"),
    DEPARTMENT_10("上海市安装工程集团有限公司", "安装工程", ""),
    DEPARTMENT_11("上海化学工业检验检测有限公司", "化学工业", "91310113771827807R"),
    DEPARTMENT_12("上海博丹环境工程技术股份有限公司", "博丹", "91310000742129487P"),
    DEPARTMENT_13("上海绿建园林有限公司", "绿建", "9131011563119223X8"),
    DEPARTMENT_14("昆山正兴深冷工程有限公司", "正兴", ""),
    DEPARTMENT_15("上海计量测试技术研究院", "计量", "123100004250979790"),
    DEPARTMENT_16("上海华捷检测工程技术有限公司", "华捷", "91310113133457469C"),
    DEPARTMENT_17("上海绿建园林养护有限公司", "绿建", "9131011563119223X8"),
    DEPARTMENT_18("上海申花光能科技有限公司", "申花", "91310101749273967Y"),
    DEPARTMENT_19("上海卓辛港口代理服务有限公司", "卓辛", "913101146941971852"),
    DEPARTMENT_20("安徽德明石油化工设备有限公司", "德明", "913401005845743656"),
    DEPARTMENT_21("抚顺海洋流体装卸设备有限公司", "抚顺海洋", "912104037268477615"),
    DEPARTMENT_22("上海煌川建设工程有限公司", "煌川", "91310230MA1JY0Q15D"),
    DEPARTMENT_23("上海华测品标检测技术有限公司", "华测", ""),
    DEPARTMENT_24("上海赢缘制冷设备有限公司", "赢缘", "91310116555985886T"),
    DEPARTMENT_25("上海石洞口煤气制气有限公司", "石洞口", "91310113631861536Q");



    private String name;
    private String shorter;
    private String code;

    JobDepartmentEnum(String name, String shorter, String code) {
        this.name = name;
        this.shorter = shorter;
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public String getShorter() {
        return shorter;
    }

    public String getCode() {
        return code;
    }


    public static String valueOfCode(String name) {
        if (StringUtils.isEmpty(name)) {
            return "91310113631861536Q";
        }

        JobDepartmentEnum departmentEnum = Arrays.stream(values()).filter(department -> name.contains(department.getShorter())).findFirst().orElse(null);

        return departmentEnum != null ? departmentEnum.getCode() : "91310113631861536Q";
    }

}